﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DevExpress.Web.ASPxGridView;

namespace Com.Rivyer.Web.contact
{
    public partial class it : System.Web.UI.Page
    {
        private readonly BLL.useroperatelogBll operatelogbll = new BLL.useroperatelogBll();
        protected void Page_Load(object sender, EventArgs e)
        {
            //非法操作验证
            if (Session["username"] == null
                || Session["username"].ToString().Trim().Length == 0)
            {
                Response.Write("<script>top.location='./login.aspx'</script>");
            }
            else
            {
                if (new BLL.userauthorityBll().GetModel(Session["username"].ToString()).isadmin == 1)
                {
                    itinfo.Columns[0].Visible = true;
                }
                else
                {
                    itinfo.Columns[0].Visible = false;
                }
            }

            
        }

        protected void itinfo_RowUpdated(object sender, DevExpress.Web.Data.ASPxDataUpdatedEventArgs e)
        {
            operatelogbll.AddLog(Session["username"].ToString(), "更新", string.Format("信息科联系表;记录数:{0}", e.AffectedRecords));
        }

        protected void itinfo_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            if (e.NewValues["telephone"] == null || e.NewValues["qq"] == null)
            {
                e.Cancel = true;
            }

            if (e.NewValues["telephone"] != null
                && !Maticsoft.Common.PageValidate.IsMobilePhone(e.NewValues["telephone"].ToString().Trim()))
            {
                e.Cancel = true;
            }
 	

            if (e.NewValues["qq"] != null
                && !Maticsoft.Common.PageValidate.IsQQ(e.NewValues["qq"].ToString()))
            {
                e.Cancel = true;
            }
        }




    }
}